import cv2
import numpy as np
import os

# 加载预定义的字典
dictionary = cv2.aruco.Dictionary_get(cv2.aruco.DICT_6X6_250)

# 新建文件夹保存图片
path = "./aruco"
if not os.path.exists(path):
    os.makedirs(path)

# 生成标记
markerImage = np.zeros((200, 200), dtype=np.uint8)
for i in range(30):
    markerImage = cv2.aruco.drawMarker(dictionary, i, 200, markerImage, 1);

    firename= os.path.join(path, "marker_" + str(i) + ".png")
    cv2.imwrite(firename, markerImage);
